package tools;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;


public class Configuration {
	public static boolean TestOnTrain = false;
	public static boolean RunSQLBatchMode = false;
	public static boolean TrainingMode = true;
	public static Double SVMCostParameter;
	public static Double SVMMinConfidence;
	public static Double SVMPolyCParameter;
	public static String RootPath;
	public static boolean selectNegFromFP = false;

	public static enum SVMKernels  {
		  Linear, //0: linear (default)
        Polynomial, //1: polynomial (s a*b+c)^d
        Radial, //2: radial basis function exp(-gamma ||a-b||^2)
        SigmoidTanh //3: sigmoid tanh(s a*b + c)
	};
	public static SVMKernels SVMKernel;
	static Properties configFile;
	public static String config_file_path = "configuration.conf";
	public static void init()
	{
		if(configFile == null){
			  configFile = new Properties();
			try {

				
				InputStream config_file = new FileInputStream(config_file_path);//
//					Configuration.class.getClassLoader().getResourceAsStream("/configuration.properties");
				configFile.load(config_file);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			SVMCostParameter = Double.parseDouble(configFile.getProperty("SVMCostParameter"));
			SVMMinConfidence = Double.parseDouble(configFile.getProperty("SVMMinConfidence"));
			SVMPolyCParameter = Double.parseDouble(configFile.getProperty("SVMPolyCParameter"));
			SVMKernel = SVMKernels.values()[Integer.parseInt(configFile.getProperty("SVMKernel"))];
			RootPath = Configuration.getValue("RootFolder");
		}
	}
	
	public static String getValue(String key){
		init();
		return configFile.getProperty(key);
	}

	public static Integer getValueInteger(String key) {
		Integer result = Integer.parseInt(getValue(key));
		return result;
	}
	
}
